package edu.suda.xsap.dto.convert;
import edu.suda.xsap.dto.MemberDto;
import edu.suda.xsap.entity.Member;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;
@Mapper(componentModel = "spring")
public interface MemberDtoToEntityConvert {

    // 单个DTO到Entity的转换
    @Mapping(source = "id", target = "id")
    @Mapping(source = "memberName", target = "name")
    @Mapping(source = "phoneNum", target = "phone")
    @Mapping(source = "birthdate", target = "birthday")
    @Mapping(source = "gender", target = "sex")
    @Mapping(source = "remark", target = "note")
    @Mapping(source = "date", target = "createtime")

    Member toEntity(MemberDto dto);

    // DTO列表到Entity列表的转换
    List<Member> toEntityList(List<MemberDto> dtos);
}